import Phaser from "phaser";

export class PreloadScene extends Phaser.Scene {
  constructor() {
    super('PreloadScene');
  }

  preload() {
    this.load.audio('jump', 'assets/jump.m4a');
    this.load.audio('hit', 'assets/hit.m4a');
    this.load.audio('reach', 'assets/reach.m4a');
    
    this.load.image('dino-hurt', 'assets/dino-hurt.png');
    this.load.image('restart', 'assets/restart.png');
    this.load.image('game-over', 'assets/game-over.png');
    this.load.image('dino-idle', 'assets/dino-idle.png');
    this.load.image('ground', 'assets/ground.png');


    this.load.spritesheet('dino-run', 'assets/dino-run.png', {
      frameWidth: 88,
      frameHeight: 94,
    });

    this.load.spritesheet('dino-down', 'assets/dino-down.png', {
      frameWidth: 118,
      frameHeight: 58,
    });

    this.load.spritesheet('enemy-bird', 'assets/enemy-bird.png', {
      frameWidth: 92,
      frameHeight: 77,
    });

    this.load.image('obstacle-1', 'assets/cactuses_1.png');
    this.load.image('obstacle-2', 'assets/cactuses_2.png');
    this.load.image('obstacle-3', 'assets/cactuses_3.png');
    this.load.image('obstacle-4', 'assets/cactuses_4.png');
    this.load.image('obstacle-5', 'assets/cactuses_5.png');
    this.load.image('obstacle-6', 'assets/cactuses_6.png');
  }

  create() {
    this.scene.start('PlayScene');
  }
}